package org.jeecg.common.easyoa.api;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.constant.ServiceNameConstants;
import org.jeecg.common.easyoa.api.factory.EasyOaBaseAPIFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * EasyOA Feign API接口
 */
@Component
@FeignClient(contextId = "easyoaBaseRemoteApi", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = EasyOaBaseAPIFallbackFactory.class)
public interface IEasyOaBaseAPI {

    /**
     * 获取公文发文模板
     *
     * @param fileId
     * @param code
     * @return
     */
    @GetMapping("/easyoa/api/oaOfficialdocOrgancode/getTemp")
    JSONObject oaOfficialdocOrgancodeGetTemp(@RequestParam("fileId") String fileId, @RequestParam("code") String code);

    /**
     * 用户id和模板id修改
     */
    @PostMapping("/oaOfficialdocTemp/editByFiledId")
    boolean oaOfficialdocTempEditByFiledId(@RequestBody JSONObject oaOfficialdocTemp);

    /**
     * 通过fileId查询所有
     *
     * @param filedId
     * @return
     */
    @GetMapping("/easyoa/api/oaOfficialdocTemp/getTempByFileId")
    JSONObject oaOfficialdocTempGetTempByFileId(@RequestParam("filedId") String filedId);

    /**
     * 通过fileId修改公文word名称
     *
     * @param filedId
     * @param name
     * @return
     */
    @GetMapping("/easyoa/api/oaOfficialdocTemp/updateNameByFileId")
    boolean oaOfficialdocTempUpdateNameByFileId(@RequestParam("filedId") String filedId, @RequestParam("name") String name);

}
